<?php // no direct access
/**
 * @package mod_blank15v43
 * @link www.blackdale.com
 * @Copyright Bob Galway
 * @license>GPL3   http://www.gnu.org/licenses/
 */

defined( '_JEXEC' ) or die( 'Restricted access' ); 
//Collect Parameters
$mode=$params->get('mode');
$code=$params->get('code');
$paddingleft=$params->get('paddingleft');
$paddingright=$params->get('paddingright');
$paddingtop=$params->get('paddingtop');
$paddingbottom=$params->get('paddingbottom');
$margintop=$params->get('margin-top');
$marginbottom=$params->get('margin-bottom');
$marginleftmodule=$params->get('margin-leftmodule');
$colour2=$params->get('colour2');
$width=$params->get('width');
$widthunit=$params->get('widthunit');
$itemid=$params->get('itemid');
$contenttitleuse=$params->get('contenttitleuse');
$contentuse=$params->get('contentuse');
$textareause=$params->get('textareause');
$reverse=$params->get('reverse');


//Some basic styling for module

echo '<div  style = "margin-top:'.$margintop.'px; margin-bottom:'.$marginbottom.'px; position:relative;left:'.$marginleftmodule.'px;padding-left:'.$paddingleft.'px; padding-right:'.$paddingright.'px; padding-top:'.$paddingtop.'px; padding-bottom:'.$paddingbottom.'px;  background-color:'.$colour2.';width:'.$width.''.$widthunit.'; ">';

//Code to place snippet in module before content page
if ($textareause==1 and $reverse==2 and $mode==1) {
    echo $code.'<br/>';
}
if ($textareause==1 and $reverse==2 and $mode==2) {
    eval($code);
}
//Code to place content page in module

// 1.  title retrieval
$db=& JFactory::getDBO();
if ($contenttitleuse==1) {
    $db->setQuery('SELECT * FROM `#__content` WHERE `id`= '.$itemid.' ORDER BY `id`');
    $contents = $db->loadObjectList();
    echo	'<h3 style="overflow:hidden">'.($contents[0]->title).'</h3>';
}

//2 . content retrieval

if ($contentuse==1) {
    $db->setQuery('SELECT * FROM `#__content` WHERE `id`= '.$itemid.' ORDER BY `id`');
    $contents = $db->loadObjectList();
    echo ($contents[0]->introtext ).'<br/>'.($contents[0]->fulltext );

}

//Code to place snippet in module after content page

if ($textareause==1 and $reverse==1 and $mode==1 ) {

    echo '<br/>'.$code;
}
if ($textareause==1 and $reverse==1 and $mode==2) {
    eval($code);
}
echo '</div>';

?>
